﻿
@{
    ViewBag.Title = "修改密码";
    Layout = "~/Areas/Manage/Views/Shared/_SubPage.cshtml";
}

@section Header{
}
@section Footer{
    <script type="text/javascript">
        var ejApp = angular.module('ejapp', ['angular-icheck']);
        ejApp.controller('mainCtrl', ['$scope', '$http', function ($scope, $http) {
            $scope.onSubmit = false;
            $scope.save = function (valid) {
                $scope.onSubmit = true;
                if (!valid) return;
                if ($scope.eModel.NewPwd != $scope.eModel.ConfirmPwd) {
                    EJ.showError("新密码和确认新密码不一致！");
                    return;
                }
                showLoading();
                $http.post("/Manage/Administrators/UpdatePassword", { "oldPwd": $scope.eModel.OldPwd, "newPwd": $scope.eModel.NewPwd, "confirmPwd": $scope.eModel.ConfirmPwd })
                    .success(function (rsp) {
                        if (rsp.Success) {
                            EJ.showSuccess("密码修改成功!");
                        } else {
                            EJ.showError(rsp.Message);
                        }
                        hideLoading();
                    })
                    .error(errorFn)
            }
        }])
    </script>
}
<div class="wrapper wrapper-content animated fadeInUp">
    <div class="row  animated slideInLeft">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-database"></i> 修改账户密码</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" name="eForm" ng-submit="save(eForm.$valid)" role="form" novalidate>
                        <div class="form-group" ng-class="{'state-error':eForm.OldPwd.$invalid&&onSubmit}">
                            <label class="col-sm-2 control-label">旧密码：<span class="require">*</span></label>
                            <div class="col-sm-6">
                                <input type="password" name="OldPwd" ng-model="eModel.OldPwd" ng-required="true" class="form-control">
                                <em ng-show="eForm.OldPwd.$invalid&&onSubmit" class="invalid">必填字段!</em>
                            </div>
                        </div>
                        <div class="form-group" ng-class="{'state-error':eForm.NewPwd.$invalid&&onSubmit}">
                            <label class="col-sm-2 control-label">新密码：<span class="require">*</span></label>
                            <div class="col-sm-6">
                                <input type="password" name="NewPwd" ng-model="eModel.NewPwd" ng-required="true" class="form-control">
                                <em ng-show="eForm.NewPwd.$invalid&&onSubmit" class="invalid">必填字段!</em>
                            </div>
                        </div>
                        <div class="form-group" ng-class="{'state-error':eForm.ConfirmPwd.$invalid&&onSubmit}">
                            <label class="col-sm-2 control-label">确认新密码：<span class="require">*</span></label>
                            <div class="col-sm-6">
                                <input type="password" name="ConfirmPwd" ng-model="eModel.ConfirmPwd" ng-required="true" class="form-control">
                                <em ng-show="eForm.ConfirmPwd.$invalid&&onSubmit" class="invalid">必填字段!</em>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存</button>
                                <button class="btn btn-white" type="reset">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
